
package forward.Module.Modules.Misc;

import forward.api.EventHandler;
import forward.api.Events.World.EventPacketSend;
import forward.api.Events.World.EventPreUpdate;
import forward.Manager.ModuleManager;
import forward.Module.Module;
import forward.Module.ModuleType;
import forward.Module.Modules.Move.Fly;
import forward.Module.Modules.Move.Teleport;
import forward.UI.ClientNotification;
import forward.Util.ClientUtil;
import forward.Util.TimerUtil;
import net.minecraft.network.play.client.C03PacketPlayer;

public class PacketMotior
extends Module {
    public static int packetcount;
    private TimerUtil time = new TimerUtil();

    public PacketMotior() {
        super("PacketMotior", new String[]{"PacketMotior"}, ModuleType.Misc);
    }

    @EventHandler
    public void OnUpdate(EventPreUpdate event) {
        if (this.time.delay(1000.0f)) {
            this.setSuffix((Object)("PPS:" + this.packetcount));
            if (this.packetcount > 25) {
                //Helper.sendMessage((String)"���ķ�������������!");
                ClientUtil.sendClientMessage("���ķ���������������", ClientNotification.Type.WARNING);
            }
            this.packetcount = 0;
            this.time.reset();
        }
    }

    @EventHandler
    public void Packet(EventPacketSend event) {
    	if (event.getPacket() instanceof C03PacketPlayer && !ModuleManager.getModuleByClass(Fly.class).isEnabled() && !ModuleManager.getModuleByClass(Teleport.class).isEnabled()) {
            ++this.packetcount;
        }
    }
}

